﻿USE SchoolManager;
IF OBJECT_ID (N'dbo.Department', N'U') IS NOT NULL
DROP TABLE dbo.Department;
CREATE TABLE [dbo].[Department] (
    [DepartmentID]   INT               IDENTITY (1, 1) NOT NULL,
    [Name]           NVARCHAR (50)     NOT NULL,
    [DepartmentHead] UNIQUEIDENTIFIER  NULL
);
ALTER TABLE [dbo].[Department]
    ADD CONSTRAINT [PK_Department] PRIMARY KEY CLUSTERED ([DepartmentID] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);
   
ALTER TABLE [dbo].[Department]
	ADD CONSTRAINT [IX_DepartmentName] UNIQUE NONCLUSTERED ([Name] ASC) WITH (ALLOW_PAGE_LOCKS = ON, ALLOW_ROW_LOCKS = ON, PAD_INDEX = OFF, IGNORE_DUP_KEY = OFF, STATISTICS_NORECOMPUTE = OFF);
	



